
<html>
<head>
    <meta charset="UTF-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>jQuery元素宽高</title> 
    <style>
        div{
            width: 100px;
            height: 100px;
            border: 1px solid black;
            background: pink;
        }
    </style>
</head>
<body>
    <div></div>
    <button>改变正方形</button>
    
</body>
<script src="./jquery.js"></script>
<script>
    $("button").click(function(){
     //获取div元素宽度
     let w=$("div").width()
    // console.log($("div").width());
    $("div").width(2*w)
    $("div").height(2*w)
    })
</script>
</html>